package br.com.dufs.mvc.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import br.com.dufs.mvc.dao.interfaces.DejetosDAO;
import br.com.dufs.mvc.model.Dejetos;

import com.fscoreunipe.mvc.dao.impl.generico.DaoGenericoImpl;

@Repository("dejetosDAO")
public class DejetosDAOImpl extends DaoGenericoImpl<Dejetos, Integer> implements
		DejetosDAO {

	private Query query;

	@SuppressWarnings("unchecked")
	@Transactional(readOnly = false)
	@Override
	public List<Dejetos> listaPorCPF(String id) {
		// TODO Auto-generated method stub
		List<Dejetos> retorno = null;

		this.query = getSessionFactory().getCurrentSession().createQuery(
				"From Dejetos where  entrevistado='" + id + "'");

		if (this.query.list().size() > 0) {
			retorno = this.query.list();
		}
		return retorno;

	}

}
